package jp.tkym.labs.store;

import jp.tkym.labs.store.api.BeanQuery;
import jp.tkym.labs.store.api.BeanStore;
import jp.tkym.labs.store.api.BeanstoreService;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;

class GoogleBeanStoreService implements BeanstoreService {
	DatastoreService datastoreService;

	GoogleBeanStoreService() {
		datastoreService = DatastoreServiceFactory.getDatastoreService();
	}

	@Override
	public <B> BeanStore<B> store(Class<B> cls) {
		return new GoogleBeanStore<B>(datastoreService, cls);
	}

	@Override
	public <B> BeanQuery<B> query(Class<B> cls) {
		return new GoogleBeanQuery<B>(datastoreService, cls);
	}
	
	DatastoreService getDatastoreService(){
		return datastoreService;
	}
}